package com.zaoyidian.controller.portal;

import com.github.pagehelper.PageInfo;
import com.zaoyidian.common.ServerResponse;
import com.zaoyidian.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Gahins on 2017/8/14.
 */

@Controller
@RequestMapping("/product/")
public class ProductController {

    @Autowired
    private IProductService iProductService;


    @RequestMapping("productList.do")
    @ResponseBody
    public ServerResponse<PageInfo> productList(@RequestParam(value = "shopId") Integer shopId,
                                                @RequestParam(value = "pageNum",defaultValue= "1")int pageNum,
                                                @RequestParam(value = "pageSize",defaultValue = "10")int pageSize,
                                                @RequestParam(value = "orderBy",defaultValue = "")String orderBy){
        return iProductService.getProductByShopId(shopId,pageNum,pageSize,orderBy);
    }
}
